package com.yfyszk.kingbird.feign;

import com.yfyszk.kingbird.common.utils.R;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/** Feign整合Sentinel实现容错
 * @ClassName MemberServiceFallBack
 * @Description: TODO
 * @Author wgc
 * @Date 2020/12/24 14:23
 * @Version V1.0
 **/
@Component
@Slf4j
public class MemberServiceFallbackFactory implements FallbackFactory<UserFeignClient>{
    @Override
    public UserFeignClient create(Throwable cause) {
        return new UserFeignClient() {
            @Override
            public String getUser(String name) {
                return "获取信息失败111";
            }

            @Override
            public String getUserOrder(String orderId) {
                return "获取订单信息失败";
            }

            @Override
            public R getUserByOrderId(String orderId) {
                return R.error("获取订单信息失败");
            }
        };
    }

}
